package API.Stream.MiddleMethod;

import java.util.Arrays;
import java.util.function.IntPredicate;

public class FilterMethod {
    public static void main(String[] args) {
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
        Arrays.stream(arr).filter(new IntPredicate() {
            @Override
            public boolean test(int value) {
                return value % 2 == 0;
            }
        }).forEach(s -> System.out.print(s + " "));
        System.out.println();
        Arrays.stream(arr).filter(s -> s % 2 == 0).
                forEach(s -> System.out.print(s + " "));
    }
}
